import axios from "../api"; // 导入 api

export const getBanner = (if_wrap = "") =>
  axios(
    STATIC_WEB_URL + "/api/web/get_lun",
    {
      p: PLAT,
      if_wrap
    },
    "GET",
    true
  );
// 获取360精选展品

export const getIndex = function () {
  return axios(
    STATIC_WEB_URL + "/api/web/get_index",
    {
      p: "t",
      language: localStorage.l ? localStorage.l : 1,
      take: 4,
    },
    "GET",
    true
  );
}
/**
 * 关于我们
 * @api /api/intro_detail
 * @apiParams p:t
 * @apiParams id=2
 *
 * */
export const getIntro = (id=2) =>
  axios(
    STATIC_WEB_URL + "/api/intro_detail",
    {
      p: PLAT,
      id
    },
    "GET",
    true
  );
/**
 * 获取展品详情接口
 * @author yh 20200415
 * @api /api/exhibit_info
 * @apiParams exhibit_id 展品id
 * @apiParams api_token 登录后必须传
 * @language 语种 1中文，2英语，3日语，4韩语，5法语，6西班牙语，7德语，8俄语，9意大利，10蒙语
 * 
 * */
export const getExhibitInfo = (exhibit_id,language = localStorage.l ? localStorage.l : 1,api_token = localStorage.app_token ? localStorage.app_token : "") =>
  axios(
    STATIC_WEB_URL + "/api/exhibit_info",
    {
      p: PLAT,
      exhibit_id,
      api_token,
      language
    },
    "GET",
    true
  );
/**
 * 获取精选展品列表接口
 * @author yh 20200415
 * @api /api/exhibit_list
 * @apiParams p:t
 * @apiParams g_id 馆id
 * @apiParams exhibition_id 展厅id
 * @apiParams  exhibit_name 搜索展厅名非必填
 * @apiParams  language 语种，1中文，2英语，3日语，4韩语，5法语，6西班牙语，7德语，8俄语，9意大利，10蒙语
 * @apiParams  page 页面
 * @apiParams  limit 条数
 * */ 
export const exhibit_list = (
  exhibition_id = 1,
  g_id = 0,
  exhibit_name ='',
  page = 1,
  limit=10,
  language = localStorage.l ? localStorage.l : 1,
) =>
  axios(
    STATIC_WEB_URL + "/api/exhibit_list",
    {
      p: PLAT,
      exhibition_id,
      g_id,
      exhibit_name,
     page,limit,
      language
    },
    "GET",
    true
  );
  /**
   * 获取全部展厅数据 
   * g_id：0全部展厅
   * language语言1中文
   * */ 
export const getExhibition_list = (g_id=0,language = localStorage.l ? localStorage.l : 1) =>
  axios(
    STATIC_WEB_URL + "/api/exhibition_list",
    {
      p: PLAT,
      g_id,
      language
    },
    "GET",
    true
  );

export const getC = (
  language = localStorage.l ? localStorage.l : 1,
  api_token = localStorage.app_token ? localStorage.app_token : ""
) =>
  axios(
    STATIC_WEB_URL + "/api/get_exhibits_from_travel",
    {
      p: PLAT,

      api_token,
      language
    },
    "GET",
    true
  );
export const doLike = (exhibit_id = 1, type = 1) =>
  axios(
    STATIC_WEB_URL + "/api/do_like",
    {
      p: PLAT,
      exhibit_id,
      type,
      language: localStorage.l ? localStorage.l : 1,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getCates = (exhibit_id = 1, take, skip) =>
  axios(
    STATIC_WEB_URL + "/api/exhibit_cate_tj",
    {
      p: PLAT,
      exhibit_id,
      take,
      skip,
      language: localStorage.l ? localStorage.l : 1,
      is_getcounts: 1
    },
    "GET",
    true
  );
export const addTravel = (exhibit_id = 1) =>
  axios(
    STATIC_WEB_URL + "/api/add_exhibit_to_travel",
    {
      p: PLAT,
      exhibit_id,
      api_token: localStorage.app_token ? localStorage.app_token : "",
      language: localStorage.l ? localStorage.l : 1
    },
    "GET",
    true
  );

export const cancelTravel = (exhibit_id = 1) =>
  axios(
    STATIC_WEB_URL + "/api/del_exhibit_from_travel",
    {
      p: PLAT,
      exhibit_id,
      api_token: localStorage.app_token ? localStorage.app_token : "",
      language: localStorage.l ? localStorage.l : 1
    },
    "GET",
    true
  );
export const getWeek = (skip = 0, take = 10) =>
  axios(
    STATIC_WEB_URL + "/api/web/every_week",
    {
      p: PLAT,
      skip,
      take
    },
    "GET",
    true
  );
export const getHall = () =>
  axios(
    STATIC_WEB_URL + "/api/web/hall",
    {
      p: "w",
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getEBanner = (language = localStorage.l ? localStorage.l : 1) =>
  axios(
    STATIC_WEB_URL + "/api/exhibition_list_recommend",
    {
      p: PLAT,
      type: 2,
      language
    },
    "GET",
    true
  );
export const getVipInfo = () =>
  axios(
    STATIC_WEB_URL + "/api/member/knowledge",
    {
      p: "t"
    },
    "GET",
    true
  );

export const registerRemeber = (
  username = "",
  sex = 1,
  portrait = "",
  nation = "",
  edu = 1,
  id_card = "",
  province = "",
  city = "",
  town = "",
  address = ""
) =>
  axios(
    STATIC_WEB_URL + "/api/member/register",
    {
      username,
      sex,
      portrait,
      nation,
      edu,
      id_card,
      province,
      city,
      town,
      address,
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "POST",
    true
  );
export const getVip = () =>
  axios(
    STATIC_WEB_URL + "/api/member/judge",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getReason = () =>
  axios(
    STATIC_WEB_URL + "/api/member/reason",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getMInfo = () =>
  axios(
    STATIC_WEB_URL + "/api/member/get_member_info",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getVipI = () =>
  axios(
    STATIC_WEB_URL + "/api/member/get_info",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getEquity = () =>
  axios(
    STATIC_WEB_URL + "/api/member/equity",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getStatus = () =>
  axios(
    STATIC_WEB_URL + "/api/travel_exhibit_status",
    {
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const getWeekD = (article_id = 1) =>
  axios(
    STATIC_WEB_URL + "/api/web/week_detail",
    {
      article_id,
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
export const doZan = article_id =>
  axios(
    STATIC_WEB_URL + "/api/web/like",
    {
      article_id,
      p: PLAT,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "POST",
    true
  );
export const visit_exhibit = (exhibit_id = "") =>
  axios(
    STATIC_WEB_URL + "/api/visit_exhibit",
    {
      p: PLAT,
      exhibit_id,
      api_token: localStorage.app_token ? localStorage.app_token : ""
    },
    "GET",
    true
  );
